package com.horsen.service.edu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.horsen.service.edu.model.Video;
import com.horsen.service.edu.mapper.VideoMapper;
import com.horsen.service.edu.service.VideoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 课程视频 服务实现类
 * </p>
 *
 * @author Horsen
 * @since 2021-04-06
 */
@Service
public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements VideoService {

    /**
     * 获取视频数
     *
     * @return 视频数
     */
    @Override
    public Integer countVideo() {
        LambdaQueryWrapper<Video> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.isNotNull(Video::getVideoSourceId)
                .ne(Video::getVideoSourceId, "");
        return baseMapper.selectCount(queryWrapper);
    }
}
